import ajax from "@lib/ajax";

const URL = 'tags';

interface IResponse {
	list: string[];
}

export default async function(text: string) {
	const res = await ajax({
		url: URL + '?text=' + encodeURIComponent(text)
	});
	if (res.success) {
		const data = (res.data as IResponse);
		return data;
	} else {
		return new Error(res.error);
	}
}